package com.hc.view.path;

import java.util.LinkedList;
import java.util.Vector;

import com.hc.R;
import com.hc.activity.PathViewSettingActivity;
import com.hc.activity.util.ActivityApplicationUtil;
import com.hc.model.EquipmentBean;
import com.hc.util.MyPoint;
import com.hc.util.data.GetStepDataThread;
import com.hc.util.fillData.WalkInfo;
import com.hc.view.path.DrawSurfaceView.myThread;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

public class ShowPathActivity extends Activity {
	private DrawSurfaceView drawSurfaceView;
	FrameLayout layout;
	private boolean isZhuan = true;//是否启动图随路转
	private boolean isStop;//启动停止画图
    private float rate = 10.0f;//缩放比例   
    private float oldRate = 10.0f;//记录上次的缩放比例   
    private float oldLineDistance;//记录第一次触屏时线段的长度      
    private boolean isFirst = true;//判定是否头次多点触屏 
	
  public static  Button btnAmplification;
    
 
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		// 当前的activity加入到关闭集合中
		ActivityApplicationUtil.getInstance().addActivity(this);
		


		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		
		
		

			layout = new FrameLayout(this);
			//生成界面内容
			drawSurfaceView = new DrawSurfaceView(this,GetStepDataThread.getDataList());
			layout.addView(drawSurfaceView);
			
			Button btnNarrow = new Button(this);
			btnNarrow.setBackgroundResource(R.drawable.selector10);
			btnNarrow.setX(200f);
			btnNarrow.setText("屏内显示");
			layout.addView(btnNarrow, 300, 120);
			btnNarrow.setOnClickListener(new View.OnClickListener() {
				public void onClick(View arg0) {
				
					DrawSurfaceView.shopwInsCreenState = true;
					
				}
			});
			
			
			Button ViewSettingBtn = new Button(this);
			ViewSettingBtn.setBackgroundResource(R.drawable.selector10);
			ViewSettingBtn.setX(2000f);
			ViewSettingBtn.setText("设置");
			layout.addView(ViewSettingBtn, 200, 120);
			ViewSettingBtn.setOnClickListener(new View.OnClickListener() {
				public void onClick(View arg0) {
				
						Intent intent = new Intent(ShowPathActivity.this,PathViewSettingActivity.class);
					startActivity(intent);
				}
			});
		
			final Button btnStopScroll = new Button(this);
			btnStopScroll.setBackgroundResource(R.drawable.selector10);
			btnStopScroll.setX(700f);
			btnStopScroll.setText("启动跟随");
			layout.addView(btnStopScroll, 300, 120);
			btnStopScroll.setOnClickListener(new View.OnClickListener() {
				public void onClick(View arg0) {
					if (isZhuan) {
						isZhuan  = false;
						btnStopScroll.setText("停止跟随");
						DrawSurfaceView.traceState = true;
						Toast.makeText(ShowPathActivity.this, "已跟随", Toast.LENGTH_SHORT).show();
					} else {
						isZhuan = true;
						btnStopScroll.setText("启动跟随");
						DrawSurfaceView.traceState = false;
						Toast.makeText(ShowPathActivity.this, "停止跟随", Toast.LENGTH_SHORT).show();
					}
				}
			});
		

			setContentView(layout);
		
		
	}
	

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		return true;
	}
	
	
	@Override
	protected void onDestroy() {
		//如果离开这个界面就中断线程，下次进来继续，开始执行
		
		super.onDestroy();
	}

}
